API Documentation
Public Member Functions | List of all members
nkAstraeus::PbsMaterial Class Referencefinal

A Physically Based Shading material. More...

Inheritance diagram for nkAstraeus::PbsMaterial:
nkAstraeus::Material

Public Member Functions

 PbsMaterial ()
 
 ~PbsMaterial ()
 
virtual MATERIAL_TYPE getType () const override
 
nkMaths::Vector getLightDirection () const
 
nkMaths::Vector getLightColor () const
 
nkMaths::Vector getAlbedoColor () const
 
nkMaths::Vector getEnvironmentColor () const
 
float getMetalness () const
 
float getRoughness () const
 
nkGraphics::TexturegetAlbedoTexture () const
 
nkGraphics::TexturegetMetalnessTexture () const
 
nkGraphics::TexturegetRoughnessTexture () const
 
nkGraphics::TexturegetEnvironmentTexture () const
 
nkGraphics::TexturegetIrradianceTexture () const
 
bool getEnvironmentTextureIsCubeByDefault () const
 
bool getIrradianceTextureIsCubeByDefault () const
 
void setLightDirection (const nkMaths::Vector &value)
 
void setLightColor (const nkMaths::Vector &value)
 
void setAlbedoColor (const nkMaths::Vector &value)
 
void setEnvironmentColor (const nkMaths::Vector &value)
 
void setMetalness (float value)
 
void setRoughness (float value)
 
void setAlbedoTexture (nkGraphics::Texture *value)
 
void setMetalnessTexture (nkGraphics::Texture *value)
 
void setRoughnessTexture (nkGraphics::Texture *value)
 
void setEnvironmentTexture (nkGraphics::Texture *value)
 
void setIrradianceTexture (nkGraphics::Texture *value)
 
void setEnvironmentTextureIsCubeByDefault (bool value)
 
void setIrradianceTextureIsCubeByDefault (bool value)
 
virtual bool load () override
 
virtual void unload () override
 
- Public Member Functions inherited from nkAstraeus::Material
 Material ()
 
virtual ~Material ()
 
std::string_view getName () const
 
nkGraphics::ShadergetShader () const
 
void setName (const std::string_view &value)
 

Detailed Description

A Physically Based Shading material.

This material aims to represent surfaces using physically plausible equations. It became a standard over the years, thanks to the limited number of parameters it requires, while offering pleasant results.

Constructor & Destructor Documentation

◆ PbsMaterial()

nkAstraeus::PbsMaterial::PbsMaterial ( )

Constructor.

◆ ~PbsMaterial()

nkAstraeus::PbsMaterial::~PbsMaterial ( )

Destructor.

Member Function Documentation

◆ getType()

virtual MATERIAL_TYPE nkAstraeus::PbsMaterial::getType ( ) const
overridevirtual
Returns
The real type of the material (MATERIAL_TYPE::PBS). See Material::getType().

Implements nkAstraeus::Material.

◆ getLightDirection()

nkMaths::Vector nkAstraeus::PbsMaterial::getLightDirection ( ) const
Returns
The currently set light direction.

◆ getLightColor()

nkMaths::Vector nkAstraeus::PbsMaterial::getLightColor ( ) const
Returns
The currently set light color.

◆ getAlbedoColor()

nkMaths::Vector nkAstraeus::PbsMaterial::getAlbedoColor ( ) const
Returns
The currently set constant albedo color.

◆ getEnvironmentColor()

nkMaths::Vector nkAstraeus::PbsMaterial::getEnvironmentColor ( ) const
Returns
The currently set constant environment color.

◆ getMetalness()

float nkAstraeus::PbsMaterial::getMetalness ( ) const
Returns
The currently set constant metalness value.

◆ getRoughness()

float nkAstraeus::PbsMaterial::getRoughness ( ) const
Returns
The currently set constant roughness value.

◆ getAlbedoTexture()

nkGraphics::Texture* nkAstraeus::PbsMaterial::getAlbedoTexture ( ) const
Returns
The currently set albedo texture.

◆ getMetalnessTexture()

nkGraphics::Texture* nkAstraeus::PbsMaterial::getMetalnessTexture ( ) const
Returns
The currently set metalness texture.

◆ getRoughnessTexture()

nkGraphics::Texture* nkAstraeus::PbsMaterial::getRoughnessTexture ( ) const
Returns
The currently set roughness texture.

◆ getEnvironmentTexture()

nkGraphics::Texture* nkAstraeus::PbsMaterial::getEnvironmentTexture ( ) const
Returns
The currently set environment texture.

◆ getIrradianceTexture()

nkGraphics::Texture* nkAstraeus::PbsMaterial::getIrradianceTexture ( ) const
Returns
The currently set irradiance texture.

◆ getEnvironmentTextureIsCubeByDefault()

bool nkAstraeus::PbsMaterial::getEnvironmentTextureIsCubeByDefault ( ) const
Returns
Whether unloaded environment textures are expected as cube maps (true) or not (false).

◆ getIrradianceTextureIsCubeByDefault()

bool nkAstraeus::PbsMaterial::getIrradianceTextureIsCubeByDefault ( ) const
Returns
Whether unloaded irradiance textures are expected as cube maps (true) or not (false).

◆ setLightDirection()

void nkAstraeus::PbsMaterial::setLightDirection ( const nkMaths::Vector value)

Sets the light direction to use within the material. Currently, the only type of light supported is directional.

Parameters
valueThe direction of the light.
Remarks
This parameter is not used if an environment texture is set.

◆ setLightColor()

void nkAstraeus::PbsMaterial::setLightColor ( const nkMaths::Vector value)

Sets the color to use for the directional light when it is active.

Parameters
valueThe light color.
Remarks
This parameter is not used if an environment texture is set.

◆ setAlbedoColor()

void nkAstraeus::PbsMaterial::setAlbedoColor ( const nkMaths::Vector value)

Sets the constant albedo (diffuse) color to use on the whole surface.

Parameters
valueThe albedo color to use.

◆ setEnvironmentColor()

void nkAstraeus::PbsMaterial::setEnvironmentColor ( const nkMaths::Vector value)

Sets a constant environment color. Can be seen as an ambient lighting.

Parameters
valueThe color to use.
Remarks
This parameter is not used if an environment texture is set.

◆ setMetalness()

void nkAstraeus::PbsMaterial::setMetalness ( float  value)

Sets the metalness of the material. Metalness is a factor between [0.0, 1.0], encoding how metallic the material should be. At 0, the material is dialectric, while at 1, it's fully metallic. Globally, at higher metallic level, the material will be more reflective.

Parameters
valueThe constant metalness to use on the whole surface.

◆ setRoughness()

void nkAstraeus::PbsMaterial::setRoughness ( float  value)

Sets the roughness of the material. Roughness is a factor between [0.0, 1.0], encoding how rough the material should be. At 0, the material is very smooth, while at 1, it is full of small rough patches. Low roughness values mean that the material will have clear reflections. As it goes higher, the reflections get blurrier.

Parameters
valueThe constant roughness to use on the whole surface.

◆ setAlbedoTexture()

void nkAstraeus::PbsMaterial::setAlbedoTexture ( nkGraphics::Texture value)

Sets the albedo (diffuse) color to use by using a texture that will be indexed using meshes texture coordinates.

Parameters
valueThe texture to use as albedo.

◆ setMetalnessTexture()

void nkAstraeus::PbsMaterial::setMetalnessTexture ( nkGraphics::Texture value)

Sets the metalness to use by using a texture that will be indexed using meshes texture coordinates.

Parameters
valueThe texture to use as albedo.

◆ setRoughnessTexture()

void nkAstraeus::PbsMaterial::setRoughnessTexture ( nkGraphics::Texture value)

Sets the roughness to use by using a texture that will be indexed using meshes texture coordinates.

Parameters
valueThe texture to use as albedo.

◆ setEnvironmentTexture()

void nkAstraeus::PbsMaterial::setEnvironmentTexture ( nkGraphics::Texture value)

Sets the environment map to use. Giving a texture enables the Image Based Lighting functionality of the material for specular reflections. The texture can be either :

  • A 2D spherical map
  • A cube map

If the texture is unloaded when the material's load() method is called, the assumed texture type will be the one given by the setEnvironmentTextureIsCubeByDefault() function.

Parameters
valueThe texture to use as the environment.

◆ setIrradianceTexture()

void nkAstraeus::PbsMaterial::setIrradianceTexture ( nkGraphics::Texture value)

Sets the irradiance map to use. Irradiance corresponds to the diffuse lighting from the environment, the average light incoming on the surface for any given direction. The texture can be either :

  • A 2D spherical map
  • A cube map

If the texture is unloaded when the material's load() method is called, the assumed texture type will be the one given by the setIrradianceTextureIsCubeByDefault() function.

Parameters
valueThe texture to use as the irradiance map.

◆ setEnvironmentTextureIsCubeByDefault()

void nkAstraeus::PbsMaterial::setEnvironmentTextureIsCubeByDefault ( bool  value)

Sets whether the environment texture given should be expected as a cube map or not, when it is unloaded while the material is loading.

Parameters
valueWhether an unloaded texture should be expected as a cube map (true) or not (false).

◆ setIrradianceTextureIsCubeByDefault()

void nkAstraeus::PbsMaterial::setIrradianceTextureIsCubeByDefault ( bool  value)

Sets whether the irradiance texture given should be expected as a cube map or not, when it is unloaded while the material is loading.

Parameters
valueWhether an unloaded texture should be expected as a cube map (true) or not (false).

◆ load()

virtual bool nkAstraeus::PbsMaterial::load ( )
overridevirtual

◆ unload()

virtual void nkAstraeus::PbsMaterial::unload ( )
overridevirtual

The documentation for this class was generated from the following file: